<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%String path=request.getContextPath();String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>">
	<title><s:text name="sys.app_title" /></title>
	<%@include file="../include/contentheader.jsp"%>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
	<link rel="stylesheet" type="text/css" href="css/dtree.css"/>
	<link rel="stylesheet" type="text/css" href="css/main.css"/>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="js/app.js"></script>
	<script type="text/javascript" src="js/dtree.js"></script>
	<script type="text/javascript" src="dwr/engine.js"></script>
	<script type="text/javascript" src="dwr/util.js"></script>
	<script type="text/javascript" src="dwr/interface/jsFN.js"></script>
	
	<script type="text/javascript">
	function validateExist(t){
		if(jQuery.trim(jQuery('input[name=opt]').val())=='0'){
		if(jQuery.trim(t)!=''){
			jsFN.hasSysTemplate(jQuery.trim(t),function(ret){
				if(ret){
					alert("该模板名称已经存在,请重新指定.");
					jQuery('input[name=templateName]').select();
				}
			});
		}}
	}
	function validate(){
		if(jQuery.trim(jQuery('input[name=templateName]').val())==''){
			alert("模板名称不能为空.");
			jQuery('input[name=templateName]').val('').focus();
			return false;
		}
		return true;
	}
	function doBack(){
		location.href="tmplt-list.action?FN=<s:property value='FN' />";
	}
	</script>
</head> 
<body>
<form action="tmplt-doOprt.action" method="post" onsubmit="return validate();">
<div class="mainContainer">
	<div class="headerTitle"><s:property value="navStr" /></div>
	<div class="dataDivLeftNoTree">

<table class="formTable" border="0" cellspacing="0" cellpadding="0">
	<tr class="operatorAction">
		<td>
			<!-- 功能性操作 -->
			<!--<input type="button" onclick="location.href='tmplt-list?FN=<s:property value='FN' />'" value="刷新" />
			<input type="button" onclick="location.href='tmplt-add?FN=<s:property value='FN' />&opt=0'" value="新增" />
			<input type="button" onclick="location.href='tmplt-del?FN=<s:property value='FN' />'" value="删除" />
			<input type="button" onclick="location.href='tmplt-export?FN=<s:property value='FN' />'" value="导出" />
			<input type="text" class="qryTxt" /><input type="button" style="margin-left:1px;" value="查询" />
			-->
			<input type="submit" value="提交" />
	        <input type="button" onclick="doBack();" value="返回" />
		</td>
	</tr>
    <tr>
		<td class="formData">
		
			<table class="dataTable" border="0" cellpadding="0" cellspacing="1">
	          <tr class="dataRow">
	            <td>模板名称：<input type="text" name="templateName" value="<s:property value='sysTemplate.templateName' />" onblur="validateExist(this.value);" <s:if test="opt==1">readonly="readonly"</s:if> /></td>
	            <td><input type="hidden" name="templateCode" value="<s:property value='sysTemplate.templateCode' />" /></td>
	          </tr>
	          <tr class="dataRow">
	            <td>模板类型：<select name="templateType">
	            	<option value="S" <s:if test="sysTemplate.templateType==\"S\"">selected</s:if>>系统初始角色</option>
	            	<option value="U" <s:if test="sysTemplate.templateType==\"U\"">selected</s:if>>用户自定义角色</option>
	            </select></td>
	            <td>模板状态：<select name="status">
	            	<option value="A" <s:if test="sysTemplate.status==\"A\"">selected</s:if>>在用</option>
	            	<option value="D" <s:if test="sysTemplate.status==\"D\"">selected</s:if>>弃用</option>
	            </select></td>
	          </tr>
	          <tr class="dataRow">
	            <td valign="top" colspan="2">模板描述：<textarea name="templateDesc" rows="5" cols="119"><s:property value='sysTemplate.templateDesc' /></textarea></td>
	          </tr>
	          <tr class="dataRow">
	            <td colspan="2">&nbsp;</td>
	          </tr>
			</table>
			<input type="hidden" name="FN" value="<s:property value='FN' />" />
			<input type="hidden" name="opt" value="<s:property value='opt' />" />
			<input type="hidden" name="seq" value="<s:property value='sysTemplate.seq' />" />
			<input type="hidden" name="crtBy" value="<s:property value='sysTemplate.crtBy' />" />
			<input type="hidden" name="crtDate" value="<s:date name="sysTemplate.crtDate" format="yyyy-MM-dd HH:mm:ss"/>" />
		
		</td>
	</tr>
</table>

	</div>
</div>
</form>
</body>  
</html>